import { isMobile } from '@/utils/device'

export function setRemMobile() {
  const { documentElement: docEl } = document
  const windowWidth = docEl.getBoundingClientRect().width
  const percentage = 100 / 750
  const rem = percentage * windowWidth
  docEl.style.fontSize = rem + 'px'
}

export function setRemPC() {
  const { documentElement: docEl } = document
  const windowWidth = docEl.getBoundingClientRect().width
  const percentage = 100 / 1920
  const rem = percentage * windowWidth
  docEl.style.fontSize = rem + 'px'
}

export function setRem() {
  if (isMobile()) {
    setRemMobile()
  } else {
    setRemPC()
  }
}
